<include file="public@header"/>
</head>
<body>
<div class="layui-fluid js-check-wrap">
    <form action="{:url('AdminPage/addPost')}" method="post" class="layui-form js-ajax-form margin-top-20">
        <div class="layui-card">
            <div class="layui-card-header">{:lang('PORTAL_ADMINPAGE_ADD')}</div>
            <div class="layui-card-body">
                <div class="layui-tab">
                    <ul class="layui-tab-title">
                        <li class="layui-this">
                            <span class="icon-wrapper"><i class="fa fa-align-center"></i></span>
                            <span class="text-wrapper">{:lang('PORTAL_ADMINPAGE_ADD')}</span>
                        </li>
                        <li>
                            <span class="icon-wrapper"><i class="fa fa-cog"></i></span>
                            <span class="text-wrapper">{:lang('SEO_OPT')}</span>
                        </li>
                    </ul>

                    <div class="layui-tab-content">
                        <div class="layui-tab-item layui-show">
                            <div class="layui-card-body">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">{:lang('TITLE')}</label>
                                    <div class="layui-input-block">
                                        <input class="layui-input" type="text" name="post[post_title]"
                                               placeholder="{:lang('PLEASE_ENTER')}{:lang('ARTICLE_TITLE')}"/>
                                    </div>
                                </div>
                                    
                                <div class="layui-form-item">
                                    <label class="layui-form-label">{:lang('ALIAS')}</label>
                                    <div class="layui-input-block">
                                        <input class="layui-input" type="text" name="post[post_alias]"
                                                placeholder="{:lang('PLEASE_ENTER')}{:lang('ALIAS')}"/>
                                        <p class="layui-word-aux">用于美化url链接</p>
                                    </div>
                                </div>
                                
                                <div class="layui-form-item">
                                    <label class="layui-form-label">{:lang('ARTICLE_EXCERPT')}</label>
                                    <div class="layui-input-block">
                                        <textarea class="layui-textarea" id="post_excerpt" name="post[post_excerpt]" rows="5"
                                                  placeholder="{:lang('PLEASE_ENTER')}{:lang('ARTICLE_EXCERPT')}">{$post.post_excerpt}</textarea>
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">{:lang('DETAIL_CONTENT')}</label>
                                    <div class="layui-input-block">
                                        <script type="text/plain" id="content" name="post[post_content]">{$post.post_content}</script>
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">{:lang('UPLOAD_IMAGE')}</label>
                                
                                    <div class="layui-input-block">
                                        <div class="upload-image">
                                            <input type="hidden" name="post[more][thumbnail]" id="thumbnail"
                                                   value="">
                                            <a href="javascript:uploadOneImage('{:lang('UPLOAD_IMAGE')}','#thumbnail');">
                                                <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                                                     id="thumbnail-preview"
                                                     width="150"/>
                                            </a>
                                            <input type="button" class="layui-btn layui-btn-danger layui-btn-sm btn-cancel-thumbnail" value="{:lang('CANCEL_PICTURE')}">
                                        </div>
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">{:lang('PUBLISHED_TIME')}</label>
                                
                                    <div class="layui-input-block">
                                        <div class="input-group">
                                            <input class="layui-input js-layui-datetime" type="text" name="post[published_time]"
                                                   value="{:date('Y-m-d H:i:s',time())}" id="published_time" readonly>
                                        </div>
                                    </div>
                                </div>

                                <!-- <div class="layui-form-item">
                                    <label class="layui-form-label">{:lang('ATTRIBUTE')}</label>
                                    <div class="layui-input-block">
                                        <input type="checkbox" id="post_status" name="post[post_status]" value="1" title="是否发布" checked>
                                    </div>
                                </div> -->

                                <div class="layui-form-item">
                                    <label class="layui-form-label">模板</label>
                                
                                    <div class="layui-input-block">
                                        <select class="layui-input" name="post[more][template]" id="more-template-select">
                                            <option value="">请选择模板</option>
                                            <foreach name="page_theme_files" item="vo">
                                                <php>$value=preg_replace('/^portal\//','',$vo['file']);</php>
                                                <option value="{$value}">{$vo.name} {$vo.file}.html</option>
                                            </foreach>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="layui-tab-item">
                            <div class="layui-card-body">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">{:lang('PAGE_TITLE')}</label>
                                    <div class="layui-input-block">
                                        <input class="layui-input" type="text" name="post[page_title]"
                                               id="keywords" placeholder="{:lang('PLEASE_ENTER')}{:lang('PAGE_TITLE')}">
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">{:lang('PAGE_KEYWORDS')}</label>
                                    <div class="layui-input-block">
                                        <input class="layui-input" type="text" name="post[page_keywords]"
                                               id="keywords" placeholder="{:lang('PLEASE_ENTER')}{:lang('PAGE_KEYWORDS')}">
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">{:lang('PAGE_DESCRIPTION')}</label>
                                    <div class="layui-input-block">
                                        <textarea class="layui-textarea" id="post_excerpt" name="post[page_description]" rows="5"
                                                  placeholder="{:lang('PLEASE_FILL_IN')}{:lang('PAGE_DESCRIPTION')}"></textarea>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="layui-form-item padding-left-25">
                    <div class="layui-input-block">
                        <button type="submit" class="layui-btn layui-btn-normal js-ajax-submit">{:lang('ADD')}</button>
                        <a class="layui-btn layui-btn-primary" href="javascript:history.back(-1);">{:lang('BACK')}</a>
                    </div>
                </div>
        </div>
    </form>
</div>

<include file="public@footer"/>
<script type="text/javascript">
    //编辑器路径定义
    var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
    $(function () {
            
        UE.getEditor('content');

        $('#more-template-select').val('page');
    });
</script>
